var Bank = [
        {id:10001, name:"中国银行"},
        {id:10002, name:"中国工商银行"},
        {id:10003, name:"中国建设银行"},
        {id:10004, name:"中国交通银行"},
        {id:10005, name:"中国光大银行"},
        {id:10006, name:"招商银行"},
        {id:10007, name:"上海浦发银行"},
        {id:10008, name:"深圳发展银行"},
        {id:10009, name:"兴业银行"},
        {id:10010, name:"中兴银行"},
        {id:10011, name:"上海银行"},
        {id:10012, name:"华厦银行"},
        {id:10013, name:"中国民生银行"},
        {id:10014, name:"北京银行"},
        {id:10015, name:"成都银行"}
];

var Experience = [
             {id:30001, name:"1年"},
             {id:30002, name:"2年"},
             {id:30003, name:"3年"},
             {id:30004, name:"4年"},
             {id:30005, name:"5年以上"}
];

var GoodAtType = [
			{id:50001, name:"笔译"},
			{id:50002, name:"口译"},
			{id:50003, name:"检查/编辑"},
			{id:50004, name:"转录"}
];

function getGoosAtTypeDesc(val) {
	var array = val.split(',');
	for (var i = 0 ; i < array.length; i++) {
		array[i] = getTypeDesc(array[i]);
	}
	return array.join(',');
}

function getTypeDesc(id) {
	id = parseInt(id);
	for (var i = 0 ; i < GoodAtType.length; i++) {
		if (GoodAtType[i].id == id) {
			return GoodAtType[i].name;
		}
	}
	return '不详';
}

function initType(id, val, radio) {
	var obj = $("#"+id);
	var fragement = new Array();
	var data = GoodAtType;
	var type_txt = radio ? "radio" : "checkbox";
	for (var i = 0 ; i < data.length ; i++) {
		var t = ''+data[i].id;
		if (val.indexOf(t) > -1) {
			fragement.push('<input type="'+type_txt+'" name="goodAt" value="'+t+'" checked="checked"/><label>'+data[i].name+'</label>');
		} else {
			fragement.push('<input type="'+type_txt+'" name="goodAt" value="'+t+'"/><label>'+data[i].name+'</label>');
		}
	}
	obj.empty();
	obj.html(fragement.join(""));
}

function initBank(id, val) {
	var obj = $("#"+id);
	var fragement = new Array();
	var data = Bank;
	fragement.push("<option value='0'>请选择银行</option>");
	
	for (var index = 0 ; index < data.length ; index ++) {
		if (val == "" + data[index].id) {
			fragement.push("<option value='" + data[index].id + "' selected='selected'>" + data[index].name + "</option>");				
		} else {
			fragement.push("<option value='" + data[index].id + "'>" + data[index].name + "</option>");
		}
	}
	obj.empty();
	obj.html(fragement.join(""));
}

function initExperience(id, val) {
	var obj = $("#"+id);
	var fragement = new Array();
	var data = Experience;
	
	for (var index = 0 ; index < data.length ; index ++) {
		if (val == "" + data[index].id) {
			fragement.push("<option value='" + data[index].id + "' selected='selected'>" + data[index].name + "</option>");				
		} else {
			fragement.push("<option value='" + data[index].id + "'>" + data[index].name + "</option>");
		}
	}
	obj.append(fragement.join(""));
}

function getExperience(id) {
	id = parseInt(id);
	for (var i = 0 ; i < Experience.length ; i ++) {
		if (id == Experience[i].id) {
			return Experience[i].name;
		}
	}
}